<?php
/**
 * Created by littleU.
 * User: littleU
 * Date: 2021-01-29
 * Time: 10:32
 */

namespace app\index\controller;


use think\Controller;

class Error extends Controller
{
    public function index()
    {
        $header = [];
        http_response_code(405);
        $error['error']['reason'] = "Method Not Allowed";
        $error['error']['message'] = "资源请求类型有误";
        foreach ($header as $key => $value)
        {
            if(is_null($value))
            {
                header($key);
            }
            else
            {
                header($key . ':' . $value);
            }
        }
        exit(json_encode($error, JSON_UNESCAPED_UNICODE));
    }
}